Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Callback Procedures

You can specify a callback procedure as the fourth parameter to the SndNewChannel function. The callback procedure executes whenever the Sound Manager processes a callBackCmd command for the channel.

MyCallbackProcedure

A callback procedure has the following syntax:

PROCEDURE MyCallbackProcedure (theChan: SndChannelPtr;
                                         theCmd: SndCommand);
theChan
A pointer to the sound channel on which a callBackCmd command was issued.
theCmd
The sound command record in which a callBackCmd command was issued.

DESCRIPTION

The Sound Manager executes the callback procedure associated with a sound channel whenever it processes a callBackCmd command for the channel. You can use a callback procedure to set a global flag that alerts the application that it must dispose of the sound channel. Or, you can use a callback procedure so that your application can synchronize a series of sound commands with other actions.

SPECIAL CONSIDERATIONS

A callback procedure is called at interrupt time. It must not make any calls to the Memory Manager, either directly or indirectly. If your callback procedure needs to access your application's global variables, you must ensure that register A5 contains your application's A5. (You can use the userInfo field of the sound channel pointed to by the theChan parameter or the param2 field of the sound command specified in the theCmd parameter to pass that value to your callback procedure.)

ASSEMBLY-LANGUAGE INFORMATION

Because a callback procedure is called at interrupt time, it must preserve all registers other than A0-A1 and D0-D2.

SEE ALSO

For information on how you can use callback procedures when playing sound asynchronously, see "Using Callback Procedures" .


© 1999 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |